#set(title="登录 - "+param("AUTH_PORTAL_NAME","JSUB"))
#@HplusLayout()
#define css()
	<link href="#(path)/hplus/css/animate.min.css" rel="stylesheet">
	<link href="#(path)/hplus/css/login.min.css" rel="stylesheet">
#end
#define content()
<div class="signin">
	<div class="signinpanel">
		<div class="row">
		<div class="col-sm-8">
	    	<div class="signin-info animated fadeInLeft">
	      	<div class="logopanel m-b"><h1>#(param("AUTH_PORTAL_NAME"))&nbsp<small>#(param("AUTH_PORTAL_VERSION"))</small></h1></div>
	        <div class="m-b" style="color:#AAA;">#(param("AUTH_PORTAL_DESC"))</div>
	       	<ul class="m-b">
	        	<li><i class="glyphicon glyphicon-play-circle m-r-xs"></i> 模块化开发模式</li>
	          <li><i class="glyphicon glyphicon-play-circle m-r-xs"></i> 模块间高度解耦</li>
	          <li><i class="glyphicon glyphicon-play-circle m-r-xs"></i> 按业务需求自由组合</li>
	          <li><i class="glyphicon glyphicon-play-circle m-r-xs"></i> 一次开发多处使用</li>
	       	</ul>
	      </div>
		</div>
	    <div class="col-sm-4">
	   		<form method="post" class="animated fadeInRight" class="am" action="doLogin" onsubmit="return ajaxLogin(this)">
	      	<h4 class="no-margins">系统登录</h4>
	        <p class="m-t-md">请输入您的用户名和密码</p>
	        <input type="text" name="username" class="form-control uname" placeholder="用户名" />
	        <input type="password" name="password" class="form-control pword m-b" placeholder="密码" />
	       	<div class="row" id="captchaBox" style="display: none;">
	       		<div class="col-sm-7">
	       		<input placeholder="请输入验证码" style="margin: 0;color: #333" class="form-control"  type="text" name="captcha">
	       		</div>
	        	<div class="col-sm-5">
	          <img class="vcode-img" style="width:100%;max-width: 120px" title="点击刷新，不区分大小写" src="captcha">
	          </div>
	         </div>
	       
	       	<button class="btn btn-success btn-block">登录</button>
	      </form>
	   	</div>
	</div>
	<div class="signup-footer animated fadeInUp">
	  	<div class="pull-left" style="color: #CCC">由&nbsp;Saas&nbsp;强力驱动</div>
	    <div class="pull-right">Powered by <a href="http://www.ztjava.com" target="_blank">ZTJava</a></div>
	 	</div>
	</div>
</div>
#end
#define jsFunction()
<script type="text/javascript">

	$(".vcode-img").click(function () {
		$(this).attr("src", "captcha?r=" + Math.random());
	});
 	function ajaxLogin(form) {
 		var $form = $(form);
 		var username = $form.find("input[name='username']");
 		var password = $form.find("input[name='password']");
 		if(username.val()==""){
 			username.focus();
 			layer.msg("请输入用户名！");
 			return false;
 		}
 		if(password.val()==""){
 			password.focus();
 			layer.msg("请输入密码！");
 			return false;
 		}
		$.ajax({
			type: 'POST',
			url:$form.attr("action"),
			data:$form.serializeArray(),
			async:false,
			dataType:"json",
			cache: false,
			success: function(json){
				if(json.result=="success") {
			  	layer.msg(json.message);
					window.location = "../index";
				}else {
					if(json.errcode==2){
						$("#captchaBox").show();
						$(".vcode-img").trigger("click");
					}
					layer.msg(json.message);
				}
			},
			error: function(){
				layer.msg(json.message);
			}
		});
 		return false;
 	}
</script>
#end